import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpDistributeOrder {
  id!: number;
  type!: number;
  orderId!: number;
  data?: unknown;
  userId!: number;
  zMoney!: string;
  oneUserId: number = 0;
  twoUserId: number = 0;
  threeUserId: number = 0;
  oneMoney!: string;
  twoMoney!: string;
  threeMoney!: string;
  state: number = 0;
  uniacid!: number;
}

export const ImsYzdKpDistributeOrderSchema = new EntitySchema({
  class: ImsYzdKpDistributeOrder,
  properties: {
    id: { primary: true, type: 'number' },
    type: { type: 'number', index: 'type' },
    orderId: { type: 'number', index: 'order_id' },
    data: { type: 'unknown', columnType: 'longtext', nullable: true },
    userId: { type: 'number', index: 'user_id' },
    zMoney: { type: 'string', columnType: 'numeric(10,2)' },
    oneUserId: { type: 'number', default: 0, index: 'one_user_id' },
    twoUserId: { type: 'number', default: 0, index: 'two_user_id' },
    threeUserId: { type: 'number', default: 0, index: 'three_user_id' },
    oneMoney: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    twoMoney: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    threeMoney: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    state: { type: 'number', default: 0, index: 'state' },
    uniacid: { type: 'number', index: 'uniacid' },
  },
});
